﻿<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>测试</title>
  </head>
  <body>
    <button id="btn">点我</button>
  </body>
  <script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
  <script type="text/javascript">
    $(function () {
      if (is_weixn()) {
        location.href =
          "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wx409fdabc9c3fbfae&redirect_uri=http://jy.nonghanxue.com/test2.html&response_type=code&scope=snsapi_base&state=STATE&connect_redirect=1#wechat_redirect";
      } else {
        location.href = "test2.html";
      }
    });
    function is_weixn() {
      var ua = window.navigator.userAgent.toLowerCase();
      if (ua.match(/MicroMessenger/i) == "micromessenger") {
        return true;
      }
      return false;
    }
  </script>
</html>
